import cv2 as cv
import numpy as np


def main():
    img = np.zeros((300, 400), np.uint8)

    step = 100
    min_val, max_val = step, 400

    for s in range(min_val, max_val, step):
        print(s)
        img[:, s:s + step] = 40 + 200 * s / max_val

    threshold = 127
    maxValue = 255
    thresholdType = cv.THRESH_BINARY

    ret, thresh = cv.threshold(img, threshold, maxValue, thresholdType)

    cv.imshow('img', img)
    cv.imshow('thresh', thresh)

    cv.waitKey(0)
    cv.destroyAllWindows()


if __name__ == "__main__":
    main()
